TryFindFirstWhere Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Finds the first item in a collection that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static bool TryFindFirstWhere<T>(
	IEnumerable<T> collection,
	Predicate<T> predicate,
	out T foundItem
)
Visual Basic (Declaration)
Public Shared Function TryFindFirstWhere(Of T) ( _
	collection As IEnumerable(Of T), _
	predicate As Predicate(Of T), _
	<OutAttribute> ByRef foundItem As T _
) As Boolean
Visual C++
public:
generic<typename T>
static bool TryFindFirstWhere (
	IEnumerable<T>^ collection, 
	Predicate<T>^ predicate, 
	[OutAttribute] T% foundItem
)

Parameters

collection
IEnumerable<(Of <T>)>
The collection to search.
predicate
Predicate<(Of <T>)>
A delegate that defined the condition to check for.
foundItem
T%
Outputs the first item in the collection that matches the condition, if the method returns true.

Return Value

True if an item satisfying the condition was found. False if no such item exists in the collection.

Type Parameters

T

See Also